package com.xul.crowd.api;

import com.xul.crowd.util.ResultEntity;
import com.xul.entity.po.MemberPO;
import com.xul.entity.vo.*;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Repository;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * @author xul
 * @create 2021-07-29 15:26
 */
@FeignClient("xul-crowd-mysql")
@Repository
public interface MysqlRemoteService {

    /**
     * 保存会员信息到数据库 给auth远程调用
     *
     * @param memberPO
     * @return
     */
    @RequestMapping("save/member/remote")
    public ResultEntity<String> saveMember(@RequestBody MemberPO memberPO);

    /**
     * 根据会员的账号 查询账号信息 给auth远程调用
     *
     * @param loginAcct
     * @return
     */
    @RequestMapping("get/memberPo/by/login/acct/remote")
    public ResultEntity<MemberPO> getMemberPOByLoginAcctRemote(@RequestParam("loginAcct") String loginAcct);

    /**
     * 将所有信息和会员的id一起保存到数据库的各各表中
     *
     * @param projectVO
     * @param memberId
     * @return
     */
    @RequestMapping("save/project/vo/remote")
    public ResultEntity<String> saveProjectVORemote(@RequestBody ProjectVO projectVO, @RequestParam("memberId") Integer memberId);

    /**
     * 查询到相应的分类t_project信息数据
     *
     * @return
     */
    @RequestMapping("get/portal/type/project/data/remote")
    public ResultEntity<List<PortalTypeVO>> getPortalTypeProjectDataRemote();


    /**
     * 根据projectId查询出详情信息 包括回报数据 头图数据 三表关联 给project远程调用
     *
     * @param projectId
     * @return
     */
    @RequestMapping("get/project/detail/remote/{projectId}")
    public ResultEntity<DetailProjectVO> getDetailProjectVORemote(@PathVariable("projectId") Integer projectId);

    /**
     * 根据returnId查询回报信息 给order远程调用
     *
     * @param projectId
     * @param returnId
     * @return
     */
    @RequestMapping("get/order/project/remote")
    public ResultEntity<OrderProjectVO> getOrderProjectRemote(@RequestParam("projectId") Integer projectId, @RequestParam("returnId") Integer returnId);

    /**
     * 查询目前的收获地址数据
     *
     * @param memberId
     * @return
     */
    @RequestMapping("get/address/vo/remote")
    public ResultEntity<List<AddressVO>> getAddressVORemote(@RequestParam("memberId") Integer memberId);

    /**
     * 保存会员地址信息
     *
     * @param addressVO
     * @return
     */
    @RequestMapping("save/address/remote")
    public ResultEntity<String> saveAddressRemote(@RequestBody AddressVO addressVO);

    /**
     * 保存订单所有信息
     *
     * @param orderVO
     * @return
     */
    @RequestMapping("save/order/remote")
    public ResultEntity<String> saveOrderRemote(@RequestBody OrderVO orderVO);
}
